function getUrlParam(){
    return window.location.search.substring(1,
        window.location.search.length);
}
function getQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var r = decodeURI(window.location.search).substr(1).match(reg);
    if (r != null) return unescape(r[2]); return null;
}
function goAction(url, data,dataType, handle) {
    $.ajax({
        type : "POST",
        url : url,
        async : false,
        data : data,
        dataType : dataType,
        error : function(request) {
            alert("请求失败");
        },
        success : function(result) {
            new handle(result);
        }
    });
}
// Ajax提交表单
function ajaxSubmit(formId, handle) {
    $.ajax({
        type : "POST",
        url : $("#" + formId).attr("action"),
        async : true,
        data : $("#" + formId).serialize(),
        error : function(request) {
            alert("请求失败");
        },
        success : function(result) {
            new handle(result);
        }
    });
}
function setCookie(name, value, days) {
    var exp = new Date(); // new Date("December 31, 9998");
    exp.setTime(exp.getTime() + days * 24 * 60 * 60 * 1000);
    document.cookie = name + "=" + escape(value) + ";expires="
        + exp.toGMTString();
}
function getCookie(name) {
    var arr = document.cookie
        .match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
    if (arr != null)
        return unescape(arr[2]);
    return null;

}
function delCookie(name) {
    var exp = new Date();
    exp.setTime(exp.getTime() - 1);
    var cval = getCookie(name);
    if (cval != null)
        document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
}

function parseDate(str){
    str = str.replace('CST','UTC+8');
    var timestamp = Date.parse(str);
    var date = new Date(timestamp);
    var Y = date.getFullYear() + '-';
    var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
    var D = date.getDate() + ' ';
    var h = date.getHours()<10 ? '0' + date.getHours() +':': date.getHours()+':';
    var m = date.getMinutes()<10 ? '0' + date.getMinutes() +':': date.getMinutes()+':';
    var s = date.getSeconds()<10 ? '0' + date.getSeconds() : date.getSeconds();
    return Y+M+D+h+m+s;
}

function formatDate(objD) {
    var str;
    var yy = objD.getYear();
    if (yy < 1900) yy = yy + 1900;
    var MM = objD.getMonth() + 1;
    if (MM < 10) MM = '0' + MM;
    var dd = objD.getDate();
    if (dd < 10) dd = '0' + dd;
    var hh = objD.getHours();
    if (hh < 10) hh = '0' + hh;
    var mm = objD.getMinutes();
    if (mm < 10) mm = '0' + mm;
    var ss = objD.getSeconds();
    if (ss < 10) ss = '0' + ss;
    var ww = objD.getDay();
    str = yy + "-" + MM + "-" + dd + " " + hh + ":" + mm + ":" + ss;
    return (str);
}